<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <!-- 若您需要使用Kendo UI Professional，请联系版权人获得合法的授权或许可。 -->
   <!-- Bootstrap css -->
    <link href="static/css/bootstrap.min.css" rel="stylesheet">
    <!-- kendo ui css -->
    <link href="static/css/kendo.common.min.css" rel="stylesheet">
    <link href="static/css/kendo.default.min.css" rel="stylesheet">
    <!-- font-awesome -->
    <link href="static/css/font-awesome.css" rel="stylesheet">
    <!--蓝鲸提供的公用样式库 -->
    <link href="static/css/bk_pack.css" rel="stylesheet">
    <!-- 如果要使用Bootstrap的js插件，必须先调入jQuery -->
    <script src="static/js/jquery-1.10.2.min.js"></script>
    <!-- 包括所有bootstrap的js插件或者可以根据需要使用的js插件调用　-->
    <script src="static/js/echarts-all.js"></script>
    <script src="static/js/bootstrap.min.js"></script>
    <!-- 包括所有kendoui的js插件或者可以根据需要使用的js插件调用　-->
    <script src="static/js/kendo.all.min.js"></script>
    <script src="static/js/echarts-all.js"></script>
    <script src="static/js/bk.js"></script>
    <script src="static/js/jquery.dataTables.js"></script>
    <script src="static/js/dataTables.bootstrap.js"></script>

    <!-- 数据埋点统计 -->
    <script src="static/js/analysis.js"></script>
    <!-- 以下两个插件用于在IE8以及以下版本浏览器支持HTML5元素和媒体查询，如果不需要用可以移除 -->
    <!--[if lt IE 9]><script src="https://magicbox.bk.tencent.com/static_api/v3/assets/js/html5shiv.min.js"></script><script src="https://magicbox.bk.tencent.com/static_api/v3/assets/js/respond.min.js"></script><![endif]-->
</head>

<body class="bg-white" data-bg-color="bg-white">
    <div class="king-page-box">
        <div class="king-layout1-header">
            <nav role="navigation" class="navbar navbar-default king-horizontal-nav2    f14 ">
                <div class="container " style="width:100%;overflow:hidden;">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed navbar-toggle-sm" data-toggle="collapse" data-target="#king-horizontal-nav2-collapse">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="javascript:;">
                            <img src="https://magicbox.bk.tencent.com/static_api/v3/bk/images/logo3.png" alt="" class="logo"> </a>
                    </div>
                    <div class="collapse navbar-collapse navbar-responsive-collapse" id="king-horizontal-nav2-collapse">
                        <ul class="nav navbar-nav">
                            <%
                                home = host_stat = history = ''
                                relative_path = APP_PATH
                                if relative_path.startswith(SITE_URL + "demo/host"):
                                    host_stat = 'king-navbar-active'
                                elif relative_path.startswith(SITE_URL + "demo/history"):
                                    history = 'king-navbar-active'
                                elif relative_path.startswith(SITE_URL + "demo/"):
                                    home = 'king-navbar-active'
                            %>
                            <li class="${home}"><a href="${SITE_URL}">首页</a></li>
                            <li class="${host_stat}"><a href="${SITE_URL}host">主机状态</a></li>
                            <li class="${history}"><a href="${SITE_URL}history">操作记录</a></li>
                        </ul>
                        <ul class="nav navbar-nav navbar-right">
                            <li>
                                <a href="javascript:;">
                                    <span>${request.user.username}</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
            </nav>
        </div>
        <%block name="content"/>
    </div>
    <script>
        $(function(){
                function renderTpl(str, cfg) {
                    var re = /(#(.+?)#)/g;

                    return str.replace(re, function() {
                        var val = cfg[arguments[2]]+'';
                        if(typeof val == 'undefined') {
                            val = '';
                        }
                        return val;
                    });
                }

                // 异步请求后台数据
                $.ajax({
                    url: 'https://magicbox.bk.tencent.com/static_api/v3/components/table7/data.json',
                    type: 'GET',
                    success: function(res){
                        var _html = ' ';
                        var list = res.items;
                        var tpl = $('#tpl_15343916241422').html();
                        var headerTpl =  $('#header_tpl_15343916241422').html();
                        for (var i=0,len=list.length; i < len; i++){
                            var item = list[i];
                            _html += renderTpl(tpl, item)
                        }
                        $('.ranger-box2 tbody').html(_html);
                        $('.ranger-box2 thead').html(renderTpl(headerTpl,res.catalogues));
                    }
                });
            });
    </script>
</body>

</html>